package com.uniview.service;

import java.util.Date;
import java.util.List;

import com.uniview.entity.po.Employees;
import com.uniview.entity.vo.Pager;
import com.uniview.entity.vo.QueryBuilder;

/**
 * 人员信息服务类操作接口
 *
 */
public interface EmployeesService {

	/**
	 * 删除所有的记录
	 * 
	 * @return
	 */
	public boolean deleteAll();

	/**
	 * 根据ID删除人员信息
	 * 
	 * @param eId
	 * @return
	 */
	public boolean deleteEmployeesById(int eId);

	/**
	 * 查询全部人员信息
	 * 
	 * @return
	 */
	public List<Employees> findAll();

	/**
	 * 根据ID查询人员信息
	 * 
	 * @param eId
	 * @return
	 */
	public Employees findEmployeesById(int eId);

	/**
	 * 根据账号（工号）查询雇员
	 * 
	 * @param userName
	 * @return
	 * @throws Exception
	 */
	public Employees findEmployeesByName(String userName);

	/**
	 * 根据更新时间查询人员信息
	 * 
	 * @param beginDate
	 * @param endDate
	 * @return
	 * @throws Exception
	 */
	public List<Employees> findEmployeesByUpdateTime(String beginDate, String endDate);

	/**
	 * 分页查询人员信息
	 * 
	 * @param queryBuilder
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	public Pager<Employees> findPageEmployees(int pageNo, int pageSize);

	public Pager<Employees> findPageEmployees(QueryBuilder queryBuilder, int pageNo, int pageSize);

	/**
	 * 获取总记录数
	 * 
	 * @return
	 * @throws Exception
	 */
	public Long getTotalRows();

	/**
	 * 根据更新日期 统计记录数
	 * 
	 * @param beginDate
	 * @param endDate
	 * @return
	 * @throws Exception
	 */
	public Integer getTotalRowsByUpdateTime(String beginDate, String endDate);

	/**
	 * 保存人员信息
	 * 
	 * @param employess
	 * @return
	 */
	public int saveEmployees(Employees employees);

	public void saveEmployeesBySql(List<Employees> list, int batchNum);

	/**
	 * 更新人员信息
	 * 
	 * @param employess
	 * @return
	 */
	public boolean updateEmployees(Employees employees);

	/**
	 * 少批量更新人员信息
	 * 
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public boolean updateEmployees(List<Employees> list);

	/**
	 * 离职人员更新
	 * 
	 * @param eId
	 * @param updateDate
	 * @return
	 */
	public boolean updateLeaveEmployees(int eId, Date updateDate);

	/**
	 * 根据员工名称进行模糊查询,获取员工id
	 * 
	 * @param name
	 * @return
	 * @throws Exception
	 */
	public String findEmployeesIdByName(String name);

	public Employees findEmployeesByWorkNo(String workNo);

	public List<Employees> findEmployeesByOrgName(String orgName);

	/**
	 * 查询日报的可视范围
	 * 
	 * @param jid
	 * @return
	 */
	public List<Employees> findEmployessByJournalId(int jid);

	/**
	 * 查询日报的可视范围
	 * 
	 * @param jid
	 * @return
	 */
	public List<Employees> findEmployessByINTJournalId(int jid);

	/**
	 * 查询日报的可视范围
	 * 
	 * @param jid
	 * @return
	 */
	public List<Employees> findEmployessByManhoursId(int jid);

	/**
	 * 新增或更新雇员信息
	 * 
	 * @param list
	 */
	public void SaveOrUpdateEmployees(List<Employees> list);

	/**
	 * 统计指定部门及其下属部门的员工数量（不包含指定工号的人）
	 * 
	 * @param orgName
	 * @param workNo
	 * @return
	 * @throws Exception
	 */
	public int countEmployeesByOrgNameWithoutCharge(String orgName, String workNo, String dept);

	/**
	 * 分页查询指定部门的下属员工
	 * 
	 * @param orgName
	 * @param workNo
	 * @param pageNo
	 * @param pageSize
	 * @return
	 * @throws Exception
	 */
	public List<Employees> findPagerEmployeesByOrgNameWithoutCharge(String orgName, String workNo, String dept,
			int pageNo, int pageSize);
	
	/**
	 * 查询指定部门的下属员工
	 * 
	 * @param orgName
	 * @param workNo
	 * @return
	 * @throws Exception
	 */
	public List<Employees> findPagerEmployeesByOrgNameWithoutCharge(String orgName, String workNo, String dept);
	
	
	public Employees findEmployeesByEmpCodeWithLike(String empCode);
	
	public List<Employees> findEmployeesByCondition(String empNameOrCode,String phone,String bindType,Integer roleId);
	
	public List<Employees> findBindedOrUnbindEmployeesList(String bindType,Integer roleId,String empName);
	
	public boolean bindUserRole(String empIds,Integer roleId);
	
	public boolean unbindUserRole(String  empId,Integer roleId);
	
	/**
	 * 保存角色关联菜单信息
	 * @param bindIds
	 * @param unbindIds
	 * @param roleId
	 * @return
	 */
	public boolean saveRoleMenuBindInfo(String bindIds,String unbindIds,Integer roleId);
	
	/**
	 * 分页查找员工信息
	 * @param empCode
	 * @param dept
	 * @param pageNo
	 * @param pageSize
	 * @return
	 * @throws Exception
	 */
	public Pager<Employees> findAllEmployeesByPage(String empCode,String dept,int pageNo,int pageSize) throws Exception;
	
	/**
	 * 分页查找员工信息
	 * @param empCode
	 * @param pageNo
	 * @param pageSize
	 * @return
	 * @throws Exception
	 */
	public Pager<Employees> findAllEmployeesByPage(String empCode,int pageNo,int pageSize) throws Exception;
	
	/**
	 * 关键字搜索雇员
	 * @param searchStr
	 * @param page
	 * @param limit
	 * @return
	 * @throws Exception
	 */
	public Pager<Employees> findEmployeesBySearch(String searchStr, String mangerNo, Integer page, Integer limit) throws Exception;
	
	
}
